package com.oo.polymorphic_4.pizza;

/**
 * PizzaFactory--${description}
 *
 * @author: Jovi
 * @createTime: 2017-05-09 17:27
 **/
public class PizzaFactory {

    public static Pizza getPizza(int id) {
        switch (id) {
            case 1:
                Pizza p1 = new BaconPizza();
                p1.setName("培根披萨");
                return p1;
            default:
                SeaPizza p2 = new SeaPizza();
                p2.setName("海鲜披萨");
                return p2;
        }
    }
}
